public class StringDemo {

    public static void main(String[] args) {
        String s1 = "this is a string";
        String s2 = new String ("this is another string");
        int i = s1.length();
        System.out.println(i);
        System.out.println(s1.charAt(2));
        System.out.println(s1.substring(4));
        System.out.println(s1.substring(1,3));//
        System.out.println(s1.indexOf("i"));
        System.out.println(s1.indexOf("ww"));
        System.out.println(s1.indexOf("i",5));
        System.out.println();
        System.out.println();
        System.out.println(s1.replace("i","O"));
        System.out.println(s1.replaceAll("is","OS"));
        System.out.println(s1.replaceFirst("is","OS"));
        System.out.println(s1.equals(s2));
        System.out.println(s1.equalsIgnoreCase("THis is a string"));
        System.out.println("AAAAA".toLowerCase());
        System.out.println("abcde".toUpperCase());
        System.out.println();
        System.out.println();
        String  s4 = "1422110410";
        System.out.println(Integer.parseInt(s4)+1);
        System.out.println(Double.parseDouble(s4));
        Integer k = 103;
        System.out.println(k.toString()+"");
        System.out.println();
        System.out.println();
        StringBuffer stringBuffer = new StringBuffer();
        int sizs;
        int  a = 10;
        double b  = 100.999999;
        stringBuffer.append(s1);
        System.out.println(stringBuffer.capacity());
        stringBuffer.append(a);
        System.out.println(stringBuffer.capacity());
        stringBuffer.append(b);
        System.out.println(stringBuffer);
        System.out.println(stringBuffer.length());
        System.out.println(stringBuffer.capacity());
    }
}
